home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-05 / pdclk139.zip / PDCLKSET.DOC < prev    next >
Text File  |  1992-05-17  |  26KB  |  502 lines

  1. ;*************************************************************************
  2. ;**                                    **
  3. ;**            PDCLKSET                    **
  4. ;**                                    **
  5. ;**                                    **
  6. ;**        Copyright (C) 1991 Jan.Engvald @ LDC.lu.se        **
  7. ;**                                    **
  8. ;** This program is free software; you can redistribute it and/or modify**
  9. ;** it under the terms of the GNU General Public License as published by**
  10. ;** the Free Software Foundation, version 1.                **
  11. ;**                                    **
  12. ;** This program is distributed in the hope that it will be useful,    **
  13. ;** but WITHOUT ANY WARRANTY; without even the implied warranty of    **
  14. ;** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the    **
  15. ;** GNU General Public License for more details.            **
  16. ;**                                    **
  17. ;** You should have received a copy of the GNU General Public License    **
  18. ;** along with this program; if not, write to the Free Software     **
  19. ;** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.        **
  20. ;**                                    **
  21. ;*************************************************************************
  22. ;**        USING PDCLKSET TO SET THE PC SOFTWARE CLOCK        **
  23. ;*************************************************************************
  24. ;**                                    **
  25. ;** PDCLKSET sets the time and date of the PC clock using a TIME server.**
  26. ;** To do so, the following information is required:            **
  27. ;**                                    **
  28. ;** - This clients unique IP number.                    **
  29. ;** - The IP number of an UDP/IP time server (most Unix systems).    **
  30. ;** - The time zone offset from UTC (GMT) at this place.        **
  31. ;** - If daylight saving (summer) time is used, which algorithm to use. **
  32. ;**                                    **
  33. ;** All the above info can be supplied as arguments to PDCLKSET. If any **
  34. ;** of the first three are missing, it will send a BOOTP request to try **
  35. ;** to find the missing info. If you are not using BOOTP you probably    **
  36. ;** must use gateway and mask arguments too. Except for client IP number**
  37. ;** and network mask, arguments to PDCLKSET override BOOTP info.    **
  38. ;** Using a BOOTP server is highly recommended, freeware code exists    **
  39. ;** for Unix systems and MSDOS PCs.                    **
  40. ;**                                    **
  41. ;** BOOTP can not supply which dst algorithm to use; also, zone offset    **
  42. ;** can't always be trusted. So, in practice, zone offset and dst algo- **
  43. ;** rithm (if applicable) are required arguments. On the other hand,    **
  44. ;** these parameters will stay the same all around the year, no need to **
  45. ;** change the setup.                            **
  46. ;**                                    **
  47. ;** If PDCLKSET finds more than one time server (sum of arguments and    **
  48. ;** BOOTP fields) and the first one does not answer, it will try the    **
  49. ;** other servers. The same applies for gateways.            **
  50. ;**                                    **
  51. ;** It is very hard to get accurate info on all the dst algorithms used **
  52. ;** all over the world, so the one you choose, you should test out. Use **
  53. ;** the alter argument to add or subtract time and days, and check that **
  54. ;** the dst switch occurs correctly. When using the alter argument, the **
  55. ;** date and time is displayed as usual, but the PC clock is not set.    **
  56. ;** If you find any errors, mail me the correct info to my mail address **
  57. ;** below. If you want to, you can customize your own dst algorithm,    **
  58. ;** see detailed info below.                        **
  59. ;**                                    **
  60. ;** PDCLKSET talks to the network card via a packet driver. If you have **
  61. ;** more than one packet driver, it will use the first one (lowest    **
  62. ;** packet interrupt number) unless you use the pktintno argument.    **
  63. ;** Currently PDCLKSET only works with Ethernet or Ethernet simulating    **
  64. ;** packet drivers.                            **
  65. ;**                                    **
  66. ;** In AUTOEXEC.BAT you should first load the packet driver, then call    **
  67. ;** PDCLKSET. It is very small (12 kbyte) and executes fast, so you will**
  68. ;** not notice any delay. PDCLKSET is not a TSR and does not require    **
  69. ;** any CONFIG.SYS files, so no memory is wasted. Use TERMIN.COM if you **
  70. ;** want to unload the packet driver. See call syntax below.        **
  71. ;** Note: If you always log into a Novell server after a boot, you    **
  72. ;** don't need this program, the PC clock will be set from the server.    **
  73. ;** However, if you are the supervisor, use PDCLKSET+SRVTIME to set it.    **
  74. ;**                                    **
  75. ;*************************************************************************
  76. ;**        USING PDCLKSET TO SET A TIMEZONE VARIABLE        **
  77. ;*************************************************************************
  78. ;**                                    **
  79. ;** PDCLKSET can also assign the proper normal or dls timezone name to    **
  80. ;** an environment variable (TZ is used by most systems). Argument    **
  81. ;** "Zone= #" will assign numeric zones to TZ (like TZ=+0100). If you    **
  82. ;** want anything else, use the alternative syntax, e.g.        **
  83. ;** "Zone= tzone=MET,METDST" will set TZONE=MET or METDST.        **
  84. ;**                                    **
  85. ;*************************************************************************
  86. ;**        USING PDCLKSET FOR NETWORK TESTING (PING)        **
  87. ;*************************************************************************
  88. ;**                                    **
  89. ;** There is also a buildt in ping client and server. If you just want    **
  90. ;** to enable the server, add a "flag=1" argument and the PDCLKSET    **
  91. ;** termination will be delayd and it responds to incoming pings until    **
  92. ;** you hit any key. If you want to send pings, use the echo argument.    **
  93. ;** When you then hit any key, it stops sending but still collects    **
  94. ;** responses. It terminates when hiting a second key. When pinging,    **
  95. ;** it displays real time statistics on delay and error rate (nice!).    **
  96. ;** PDCLKSET sets the hardware timer to enable millisecond accurate    **
  97. ;** timing; if your PC does not like this, add argument "flag=16".    **
  98. ;**                                    **
  99. ;** A typical ping call look like:                    **
  100. ;**                                    **
  101. ;**    pdclkset echo=ping.lu.se,30,256                    **
  102. ;**                                    **
  103. ;** The display will look like this:                    **
  104. ;**                                    **
  105. ;** Calling nameserver(s)... got reply in  115 ms.            **
  106. ;**                                    **
  107. ;** Ping with packet size 30 and interval   256 ms to 130.235.128.100:    **
  108. ;**                                    **
  109. ;** ------ Packets ------ | --- Delay ms --- |  Packet  | Load | Time    **
  110. ;** transmit receive diff | this min avg max |   loss    | kb/s |    s    **
  111. ;**     187     184    3     87  27  36 517    1.6042 %     5     41    **
  112. ;**                                    **
  113. ;**                                    **
  114. ;** You can use IP packet sizes from 28 to 1500. While a few network    **
  115. ;** errors only show up at a certain size, the default 30 is good in    **
  116. ;** most cases and does not unnecessary load links. If you use a    **
  117. ;** negative size, it will sweep packet sizes from 28 up to abs(size)    **
  118. ;** and unless you hit ESC at termination an error size distribution    **
  119. ;** table is displayd. You can then see if packets are lost randomly or    **
  120. ;** in bursts or if there is a pattern, like odd or big sizes. Sweeping    **
  121. ;** is very effective for detecting queue limits in routers and bridges.**
  122. ;** The ping packet data is by default starting at 0x101 and incremented**
  123. ;** by one for each word in the packet. Using the optional data and inc    **
  124. ;** fields you can fill with other values, like 0,0 or 0xffff,0 which    **
  125. ;** is useful for WAN modem link tests.                    **
  126. ;**                                    **
  127. ;** Packets are transmitted at a constant rate depending on interval,    **
  128. ;** which can be from 0 and up to 32000. The interval unit is now 1    **
  129. ;** millisecond (Note: ver 1.33 had 55 ms units!). As a safety for    **
  130. ;** accidental loading, if you wan't intervals less than 128 ms you    **
  131. ;** must add a Flag=1 argument. When pinging in a wide area network    **
  132. ;** environment, watch the load figure (calibrated for half duplex    **
  133. ;** media such as Ethernet or LocalTalk) not to overload slow links.     **
  134. ;**                                    **
  135. ;** The destination host must run IP and you can use its IP number or    **
  136. ;** its domain name.                            **
  137. ;**                                    **
  138. ;** Diff is the difference between sent and received packets, and if    **
  139. ;** not zero either packets are lost or are in transit. If there are    **
  140. ;** network errors, watching how receive and diff increments tell you    **
  141. ;** how the errors are distributed in time (temporary total blocking or **
  142. ;** just random drops) down to tenths of a second (very useful!).    **
  143. ;** Blocking indicates serious errors, else it can be just high load.    **
  144. ;**                                    **
  145. ;** The delay values are useful to characterize link loads. After a    **
  146. ;** while, the min value approaches the delay on an unloaded link. If    **
  147. ;** the average value is significantly higher, the link is loaded. If    **
  148. ;** the max value is significantly higher than the avg value, the load    **
  149. ;** is bursty. The "this" field shows the current delay.        **
  150. ;**                                    **
  151. ;** Packet loss is simply 100*diff/transmit. If the host you are    **
  152. ;** pinging don't drop packets (many do, a 386 with PDCLKSET doesn't),    **
  153. ;** the packet loss as a symptom of network health is as follows:    **
  154. ;**                                    **
  155. ;**   0.01 % or less  : your network is helthy.             **
  156. ;**   0.01 % to 0.1 % : there are some minor faults but nobody will    **
  157. ;**            notice any delays.                **
  158. ;**   0.1 % to 1 %    : you will notice delays more or less often.    **
  159. ;**   1 % or more     : frequent delays, very annoying.         **
  160. ;**                                    **
  161. ;** The display is updated five times a second. To avoid unpleasant    **
  162. ;** value flickering, when a packet is just sent, diff is temporarily    **
  163. ;** one less than it should be. When a packet has arrived it is back to    **
  164. ;** normal. All values (except the "this" and the load values) are    **
  165. ;** accumulated or averaged during the complete time since pdclkset was    **
  166. ;** last started. The time field tells you this elapsed time.        **
  167. ;**                                    **
  168. ;*************************************************************************
  169. ;**        USING PDTBUILD TO GENERATE TABLES WITH ALL IP HOSTS    **
  170. ;*************************************************************************
  171. ;**                                    **
  172. ;** The PDTBUILD program, which is included in the ZIP package, looks    **
  173. ;** at all ARP broadcasts and generates a table with all the IP hosts    **
  174. ;** on this (sub)net. Each entry has IP number, Ethernet address and    **
  175. ;** host name, the latter which it asks a name server for. Two files    **
  176. ;** are generated, IPTBL.TXT and HWTBL.TXT, which are suitable as input **
  177. ;** to LANwatch or a LANalyzer or other monitors. It should preferably    **
  178. ;** be run for a complete day or longer. When started, if IPTBL.TXT    **
  179. ;** exists it will read it in and update with what it sees on the net.    **
  180. ;** It can handle up to 4000 hosts.                    **
  181. ;**                                    **
  182. ;** In the comment field, an A means authorative answer, N is non-    **
  183. ;** authorative answer from nameserver. 0 means host not registered    **
  184. ;** for reverse lookup (in-addr.arpa domain). - means name not found.    **
  185. ;** < and = denotes Ethernet duplicates for same IP address. >, = and +    **
  186. ;** denotes IP duplicates for same Ethernetaddress.            **
  187. ;**                                    **
  188. ;** You can speed up address collection by adding flag=8. This will    **
  189. ;** start ARP probing, a process that cycles through all IP adresses in    **
  190. ;** the (sub)net and sends an ARP request for each address. The speed    **
  191. ;** is 9 ARP requests per second, slowing down to two per second when    **
  192. ;** nameserver requests are needed. It is rather successful in ignoring    **
  193. ;** ARP replies from proxy ARP gateways (otherwise it would table a lot    **
  194. ;** of fake hosts).                            **
  195. ;**                                    **
  196. ;** You can run echo (ping) in parallell with tablebuilding (and the    **
  197. ;** ARP probing), although the screen display is somewhat mixed. I do    **
  198. ;** it because the screen then is updated regularly and I can see it is    **
  199. ;** running.                                **
  200. ;**                                    **
  201. ;** The tblbuild code is a quick hack, undocumented, but works for me.    **
  202. ;**                                    **
  203. ;*************************************************************************
  204. ;**        PDCLKSET (and PDTBUILD) CALL SYNTAX            **
  205. ;*************************************************************************
  206. ;**                                    **
  207. ;**   (time is [- | +] [<hours>h] [<minutes>m] [<seconds>[s]] )     **
  208. ;**                                    **
  209. ;** pdclkset            (displays a usage message)    or    **
  210. ;**                                    **
  211. ;** pdclkset b[ootp]        (only if dst not used)    or        **
  212. ;**                                    **
  213. ;** pdclkset [o[ffset]=time]                        **
  214. ;**                                    **
  215. ;**         [d[aylightsave]=PAC | USA | CUB | CHIL | BRZ | GBR |    **
  216. ;**                 W_EU | M_EU | E_EU | LIBY | EGY | TURK |    **
  217. ;**                 ISR | IRAN | PRC | ROK | AUS | TASM |    **
  218. ;**                 NSW | LHI | NZE |                **
  219. ;**                 FrTime,FrWeekDay,FrDayOfYear,        **
  220. ;**                 ToTime,ToWday,ToDayOfYr,AddTime]        **
  221. ;**                                    **
  222. ;**         [z[onename]= # | varible=normalname,dlsname        **
  223. ;**                                    **
  224. ;**         [i[pnr]=n.n.n.n]  [t[imservers]=n.n.n.n[,n.n.n.n[,...]]]    **
  225. ;**                                    **
  226. ;**         [m[ask]=n.n.n.n  g[ateways]=n.n.n.n[,n.n.n.n[,...]]]    **
  227. ;**                                    **
  228. ;**         [p[ktintno]=hexnr]  [a[lter]=days,time]  [f[lags]=flagnr]    **
  229. ;**                                    **
  230. ;**         [e[cho]= name | n.n.n.n [,size[,interval[,data[,inc]]]]]    **
  231. ;**                                    **
  232. ;**         [n[ameservers]=n.n.n.n[,n.n.n.n[,...]]]            **
  233. ;**                                    **
  234. ;**                                    **
  235. ;** Examples:                                **
  236. ;**                                    **
  237. ;** pdclkset o= -1h d=M_EU z=#     (my IP nr and timeserver(s) from BOOTP)**
  238. ;**                                    **
  239. ;** pdclkset offs=6h dst=USA zonename= tz=CST,CDT  (sets TZ=CST or CDT) **
  240. ;**                                    **
  241. ;** pdclkset o=8h  d=PAC  ip=123.45.6.7  ts=123.45.6.8    (BOOTP not used)**
  242. ;**                                    **
  243. ;** pdclkset o=-9h30m t=1.2.3.4 i=2.3.4.5 g=2.3.4.1 m=255.255.255.0    **
  244. ;**                                    **
  245. ;** pdclkset pktdrv= 0x7e  echo=ping.lu.se          (ping client) **
  246. ;**                                    **
  247. ;** pdclkset flags= 1                      (ping server) **
  248. ;**                                    **
  249. ;** pdtbuild flags= 2                   (LANalyzer table builder) **
  250. ;**                                    **
  251. ;** pdtbuild flags= 2+4                   (LANwatch table builder) **
  252. ;**                                    **
  253. ;** pdtbuild flags= 2+8              (table building with probing) **
  254. ;**                                    **
  255. ;**                                    **
  256. ;** Part of an AUTOEXEC.BAT file may look like this:            **
  257. ;**                                    **
  258. ;**    \net\wd8003e -w 0x7d 3 0x280 0xd000    (install packet driver) **
  259. ;**    \net\winpkt 0x7c 0x7d            (install winpkt driver) **
  260. ;**    \net\pdclkset o=-1h d=M_EU z=#        (set PC clock and TZ)    **
  261. ;**                                    **
  262. ;** If you don't want to keep the paket drivers in memory, add the    **
  263. ;** following line:                            **
  264. ;**                                    **
  265. ;**    \net\termin 0x7c            (remove packet drivers)    **
  266. ;**                                    **
  267. ;*************************************************************************
  268. ;**        HISTORY                         **
  269. ;*************************************************************************
  270. ;**                                    **
  271. ;** Ver 0.85: Beta release.                        **
  272. ;**                                    **
  273. ;** Ver 1.02: First official release.                    **
  274. ;**          Removed 386-only instructions. Numerous minor changes.    **
  275. ;**          Corrected the Pacific daylight algorithm.         **
  276. ;**                                    **
  277. ;** Ver 1.10: Selected release with support for one gateway.        **
  278. ;**                                    **
  279. ;** Ver 1.27: Major rewrite of the UDP/IP library to make it mostly RFC **
  280. ;**          compliant. Multi gateway and multi timeserver support.    **
  281. ;**          Fixed hangs on argument syntax errors.            **
  282. ;**          Added comments and documentation to the code.        **
  283. ;**          Added ping server and client function.            **
  284. ;**                                    **
  285. ;** Ver 1.28: Added fragment reassembly.                **
  286. ;**          Added PDTBUILD application to automatically generate    **
  287. ;**          hardware and IP tables by watching network traffic.    **
  288. ;**                                    **
  289. ;** Ver 1.29: Added SQID (Source Quench Introduced Delay)        **
  290. ;**          All time compares changed to js/jns instead of jl/jge,    **
  291. ;**          avoiding wrong handling once every hour.            **
  292. ;**                                    **
  293. ;** Ver 1.30: Added timezone environment variable handling (SET TZ=...).**
  294. ;**          Timeserver not needed to ping or build tables.        **
  295. ;**                                    **
  296. ;** Ver 1.31: Ping delays now millisecond accurate.            **
  297. ;**                                    **
  298. ;** Ver 1.32: Corrected check on illegal ping packet size.        **
  299. ;**          Ping display cleaned up and overhead reduced.        **
  300. ;**          Corrected BufAlloc error when out of buffers.        **
  301. ;**                                    **
  302. ;** Ver 1.33: Fixed PDTBUILD error when not tablebuilding. Ping     **
  303. ;**          enhancements: Time server not needed, added elapsed ping    **
  304. ;**          time field, send error messages displayed.        **
  305. ;**                                    **
  306. ;** Ver 1.34: Made a table for arg decode. Negative ping size will now     **
  307. ;**          sweep from 28 up to abs(size). Also odd sizes work.    **
  308. ;**          Added code in AdjTo16bits to avoid divide overflow.    **
  309. ;**                                    **
  310. ;** Ver 1.35: Made performance improvements. A 386SX with 16-bit WD    **
  311. ;**          card can now handle 2000 pkts/s short packets (send +    **
  312. ;**          receive) or load to 7 Mb/s (long packets). Echo interval    **
  313. ;**          is now in units of milliseconds (actually 0.858 ms)    **
  314. ;**          instead of 55 ms ticks. Added traffic load field in the    **
  315. ;**          display. Added several debug checks.            **
  316. ;**                                    **
  317. ;** Ver 1.36: Made documentation changes for the above new features.    **
  318. ;**                                    **
  319. ;** Ver 1.37: Added domain name resolver for ping. Corrected a bug in    **
  320. ;**          fragment reassembly. Changed length input to SendUdpPkt.    **
  321. ;**          Found bug preventing inactivity timeout for remote hosts.    **
  322. ;**                                    **
  323. ;** Ver 1.38: TblBuild redesigned to be able to detect both IP and    **
  324. ;**          hardware address duplicates. Corrected a bug when out of    **
  325. ;**          buffers trying to send unreachables.            **
  326. ;**                                    **
  327. ;** Ver 1.39: TblBuild enhanced with an active probe function to speed    **
  328. ;**          up address collection.                    **
  329. ;**                                    **
  330. ;*************************************************************************
  331. ;**        ACKNOWLEDGMENTS                     **
  332. ;*************************************************************************
  333. ;**                                    **
  334. ;** The checksum routine used is a modified NCSA Telnet version.    **
  335. ;** The dst algorithm was modelled after PCIP SETCLOCK (thanks Drew!),    **
  336. ;** but enhanced to use parameters from a table.            **
  337. ;** The dst algorithm table was derived from a comp.sources.unix 1989    **
  338. ;** posting by ado@ncifcrf.gov of localtime.c and related routines    **
  339. ;** and tables, and a later update (very useful data, thanks!).     **
  340. ;** The master environment is found using Pat's code.            **
  341. ;** The millisecond timer is based on code from Dean Pentcheff.     **
  342. ;** The DateTimeCalc routine is my own invention.            **
  343. ;** The packet driver interface routines were copied from the Crynwr    **
  344. ;** packet driver distribution, without which this project would not    **
  345. ;** have been possible (thanks Russ!).                    **
  346. ;**                                    **
  347. ;** The small UDP/IP library was written by me, and can probably be    **
  348. ;** used in other small assembler applications. It is now fully RFC    **
  349. ;** compliant, except for a few small cases mentioned in the code. It    **
  350. ;** DOES handle IP type of service, fragment reassembly, source quench    **
  351. ;** throttling, sending port and protocol unreachables, multiple    **
  352. ;** default gateways, etc.                        **
  353. ;**                                    **
  354. ;*************************************************************************
  355. ;**        WHERE TO GET IT FROM                    **
  356. ;*************************************************************************
  357. ;**                                    **
  358. ;** Current version of PDCLKSET can be obtained by anonymous FTP from    **
  359. ;** ftp.lu.se:/pub/network/pdclkset/pdclkxxx.zip or from Novell server    **
  360. ;** LUKUNDFS/SYS:PUB\NETWORK\PDCLKSET\PDCLKxxx.ZIP (Netware access only    **
  361. ;** in Lund and around).                        **
  362. ;** Major releases will also be available on wsmr-simtel20.army.mil and **
  363. ;** its mirror archive sites in the msdos.lan directory.        **
  364. ;**                                    **
  365. ;*                                     *
  366. ;* Jan Engvald, Lund University Computing Center             *
  367. ;* ____________________________________________________________________  *
  368. ;*   Address: Box 783            E-mail: Jan.Engvald@ldc.lu.se     *
  369. ;*          S-220 07 LUND    Earn/Bitnet: xjeldc@seldc52         *
  370. ;*          SWEDEN          (Span/Hepnet: Sweden::Gemini::xjeldc)     *
  371. ;*    Office: Soelvegatan 18        VAXPSI: psi%2403732202020::xjeldc     *
  372. ;* Telephone: +46 46 107458        (X.400: C=se; A=""; P=Sunet; O=lu;     *
  373. ;*   Telefax: +46 46 138225            OU=ldc; S=Engvald; G=Jan)     *
  374. ;*     Telex: 33533 LUNIVER S                         *
  375. ;*                                     *
  376. ;*************************************************************************
  377.  
  378. ; Note: If you want to assemble this code yourself, you need Turbo ASM 
  379. ; (at least MASM 5.1 does not like comments on structure calls!).
  380. ; Also, some files from the Crynwr packet driver collection are needed.
  381.  
  382. ;************************************************************************
  383. ;*        Compile time constants                    *
  384. ;************************************************************************
  385.  
  386.         .lfcond  
  387. PRGVERSION    equ    ' v1.39'
  388. TBLBUILD     equ     0
  389. PINGCLIENT     equ     1
  390. DEBUG         equ     0
  391.  
  392. MN        equ    60            ; seconds in a minute
  393. HR        equ    60*MN            ; seconds in an hour
  394.  
  395. SUN        equ    0            ; Sunday
  396. SAT        equ    6            ; Saturday
  397. DAT        equ    0ffh            ; Specific date follows
  398.  
  399. FEB2W        equ    31+2*7                ; Feb 2nd week
  400. MAR1W        equ    31+28+1*7            ; Mar 1st week
  401. MAR2W        equ    31+28+2*7            ; Mar 2nd week
  402. MAR3W        equ    31+28+3*7            ; Mar 2rd week
  403. MARLW        equ    31+28+31            ; Mar last week
  404. APR01        equ    31+28+31+1            ; Apr 1
  405. APR03        equ    31+28+31+3            ; Apr 3
  406. APR07        equ    31+28+31+7            ; Apr 7
  407. APR1W        equ    31+28+31+1*7            ; Apr 1st week
  408. APR2W        equ    31+28+31+2*7            ; Apr 2nd week
  409. APR18        equ    31+28+31+18            ; Apr 18
  410. APRNL        equ    31+28+31+30-7            ; Apr next last week
  411. APR23        equ    31+28+31+23            ; Apr 23
  412. APR26        equ    31+28+31+26            ; Apr 26
  413. MAY01        equ    31+28+31+30+1            ; May 1
  414. MAY2W        equ    31+28+31+30+2*7         ; May 2nd week
  415. AUG28        equ    31+28+31+30+31+30+31+28     ; Aug 28
  416. SEP01        equ    31+28+31+30+31+30+31+31+1    ; Sep 1
  417. SEP12        equ    31+28+31+30+31+30+31+31+12    ; Sep 12
  418. SEP2W        equ    31+28+31+30+31+30+31+31+2*7    ; Sep 2nd week
  419. SEP17        equ    31+28+31+30+31+30+31+31+17    ; Sep 17
  420. SEP20        equ    31+28+31+30+31+30+31+31+20    ; Sep 20
  421. SEP3W        equ    31+28+31+30+31+30+31+31+3*7    ; Sep 3rd week
  422. SEP30        equ    31+28+31+30+31+30+31+31+30    ; Sep 30
  423. SEPLW        equ    31+28+31+30+31+30+31+31+30    ; Sep last week
  424. OCT01        equ    31+28+31+30+31+30+31+31+30+1    ; Oct 1
  425. OCT2W        equ    31+28+31+30+31+30+31+31+30+2*7    ; Oct 2nd week
  426. OCT24        equ    31+28+31+30+31+30+31+31+30+24    ; Oct 18 - 24
  427. OCT4W        equ    31+28+31+30+31+30+31+31+30+4*7    ; Oct 4th week
  428. OCT29        equ    31+28+31+30+31+30+31+31+30+29    ; Oct 23 - 29
  429. OCTLW        equ    31+28+31+30+31+30+31+31+30+31        ; Oct last week
  430. NOV13        equ    31+28+31+30+31+30+31+31+30+31+13    ; Nov 5 - 13
  431.  
  432. AlgE        struc
  433. AlgName     db    "EUR "            ; Name of dst algorithm
  434. AlgFromTime    dw    2*HR            ; local standard time dst start
  435. AlgFromWeekDay    dw    SUN            ; weekday dst start
  436. AlgFromWeek    dw    MARLW            ; last day-of-year dst start
  437. AlgUntilTime    dw    2*HR            ; local standard time dst end
  438. AlgUntilWeekDay dw    SUN            ; weekday dst end
  439. AlgUntilWeek    dw    SEPLW            ; last day-of-year dst end
  440. AlgAddAmount    dw    1*HR            ; dst advance amount
  441. AlgEntryLen    equ    $-AlgName
  442. AlgE        ends
  443.  
  444. AlgData        struc
  445. AUSA AlgE <"USA ", 2*HR,SUN,APR1W, 1*HR,SUN,OCTLW, HR>    ; USA Canada Mexico
  446. ACub AlgE <"CUB ", 0*HR,SUN,MAY2W,-1*HR,SUN,OCT2W, HR>    ; Cuba
  447. AChl AlgE <"CHIL", 0*HR,SUN,OCT2W,-1*HR,SUN,MAR2W, HR>    ; Chile
  448. ABrz AlgE <"BRZ ", 2*HR,SAT,OCT4W, 1*HR,SAT,FEB2W, HR>    ; Brazil
  449. AGBR AlgE <"GBR ", 1*HR,SUN,MARLW, 1*HR,SUN,OCT29, HR>    ; United Kingdom
  450. AWEu AlgE <"W_EU", 1*HR,SUN,MARLW, 1*HR,SUN,SEPLW, HR>    ; West Europe
  451. AMEu AlgE <"M_EU", 2*HR,SUN,MARLW, 2*HR,SUN,SEPLW, HR>    ; Central Europe + SU
  452. AEEu AlgE <"E_EU", 3*HR,SUN,MARLW, 3*HR,SUN,SEPLW, HR>    ; East Europe
  453. ALby AlgE <"LIBY", 2*HR,DAT,APR01, 1*HR,DAT,SEP30, HR>    ; Libya
  454. AEgy AlgE <"EGY ", 2*HR,DAT,MAY01, 1*HR,DAT,OCT01, HR>    ; Egypt
  455. ATur AlgE <"TURK", 1*HR,SUN,MARLW, 0*HR,SUN,SEPLW, HR>    ; Turkey
  456. AIra AlgE <"IRAN", 2*HR,SUN,MARLW, 1*HR,SUN,SEP3W, HR>    ; Iran
  457. APRC AlgE <"PRC ", 2*HR,SUN,APR2W, 2*HR,SUN,SEP2W, HR>    ; People Rep of China
  458. AROK AlgE <"ROK ", 2*HR,SUN,MAY2W, 2*HR,SUN,OCT2W, HR>    ; Rep of Korea
  459. AAus AlgE <"AUS ", 2*HR,SUN,OCTLW, 2*HR,SUN,MAR3W, HR>    ; South Australia
  460. ATas AlgE <"TASM", 2*HR,SUN,OCT24, 2*HR,SUN,MAR3W, HR>    ; Tasmania
  461. ANSW AlgE <"NSW ", 2*HR,SUN,OCTLW, 2*HR,SUN,MAR1W, HR>    ; New South Wales
  462. ALHI AlgE <"LHI ", 2*HR,SUN,OCTLW, 2*HR,SUN,MAR1W, 30*MN> ; LHI (Australia) 
  463. ANZe AlgE <"NZE ", 2*HR,SUN,OCTLW, 2*HR,SUN,MAR1W, HR>    ; New Zealand
  464.  
  465. ; All entries below this line are indexed by year modulo 4
  466.  
  467. APa0 AlgE <"PAC ", 2*HR,SUN,APR1W, 1*HR,SUN,NOV13, HR>    ; Pacific presidential
  468. APa1 AlgE <"PAC ", 2*HR,SUN,APR1W, 1*HR,SUN,OCTLW, HR>    ; Pacific non-pres
  469. APa2 AlgE <"PAC ", 2*HR,SUN,APR1W, 1*HR,SUN,OCTLW, HR>    ; Pacific non-pres
  470. APa3 AlgE <"PAC ", 2*HR,SUN,APR1W, 1*HR,SUN,OCTLW, HR>    ; Pacific non-pres
  471.  
  472. ; All entries above this line are cyclic and will last forever
  473. ; All entries below this line are non-cyclic, they only last 4 years
  474.  
  475. AIs0 AlgE <"ISR ", 0*HR,DAT,APR26,-1*HR,DAT,SEP20, HR>    ; Israel 1992
  476. AIs1 AlgE <"ISR ", 0*HR,DAT,APR18,-1*HR,DAT,SEP12, HR>    ; Israel 1993
  477. AIs2 AlgE <"ISR ", 0*HR,DAT,APR03,-1*HR,DAT,AUG28, HR>    ; Israel 1994
  478. AIs3 AlgE <"ISR ", 0*HR,DAT,APR23,-1*HR,DAT,SEP17, HR>    ; Israel 1995
  479.  
  480. if 0    ; as years go by, replace entries above from below with same label
  481. AIs0 AlgE <"ISR ", 0*HR,DAT,APR14,-1*HR,DAT,SEP08, HR>    ; Israel 1996
  482. AIs1 AlgE <"ISR ", 0*HR,DAT,MAY04,-1*HR,DAT,SEP28, HR>    ; Israel 1997
  483. AIs2 AlgE <"ISR ", 0*HR,DAT,APR19,-1*HR,DAT,SEP13, HR>    ; Israel 1998
  484. AIs3 AlgE <"ISR ", 0*HR,DAT,APR11,-1*HR,DAT,SEP05, HR>    ; Israel 1999
  485. AIs0 AlgE <"ISR ", 0*HR,DAT,APR30,-1*HR,DAT,SEP24, HR>    ; Israel 2000
  486. AIs1 AlgE <"ISR ", 0*HR,DAT,APR15,-1*HR,DAT,SEP09, HR>    ; Israel 2001
  487. AIs2 AlgE <"ISR ", 0*HR,DAT,APR07,-1*HR,DAT,SEP01, HR>    ; Israel 2002
  488. AIs3 AlgE <"ISR ", 0*HR,DAT,APR27,-1*HR,DAT,SEP21, HR>    ; Israel 2003
  489. AIs0 AlgE <"ISR ", 0*HR,DAT,APR18,-1*HR,DAT,SEP12, HR>    ; Israel 2004
  490. AIs1 AlgE <"ISR ", 0*HR,DAT,MAY01,-1*HR,DAT,SEP25, HR>    ; Israel 2005
  491. AIs2 AlgE <"ISR ", 0*HR,DAT,APR23,-1*HR,DAT,SEP17, HR>    ; Israel 2006
  492. AIs3 AlgE <"ISR ", 0*HR,DAT,APR15,-1*HR,DAT,SEP09, HR>    ; Israel 2007
  493. AIs0 AlgE <"ISR ", 0*HR,DAT,APR27,-1*HR,DAT,SEP21, HR>    ; Israel 2008
  494. AIs1 AlgE <"ISR ", 0*HR,DAT,APR19,-1*HR,DAT,SEP13, HR>    ; Israel 2009
  495. endif
  496. AlgData        ends
  497.  
  498. WARNYEAR    equ    1996            ; acyclic data invalid year
  499.  
  500. ;************************************************************************
  501.  
  502.